import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import AffairList from '../views/manage/Affairs.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/home',
    meta: {
      title: '首页'
    }
  },
  {
    path: '/home',
    name: 'Home2',
    component: Home,
    meta: {
      title: '首页'
    }
  },
  {
    // 事项
    path: '/affairs',
    name: 'Affairs',
    component: AffairList,
    meta: {
      title: '事项'
    }
  },
  {
    path: '/flow_charts',
    name: 'FlowChart',
    component: () => import('../views/manage/FlowChart.vue'),
    meta: {
      title: '流程图列表'
    }
  },
  {
    path: '/flow_charts/design/:id',
    name: 'FlowChartDesign',
    component: () => import('../views/manage/design/Index.vue'),
    meta: {
      title: '流程图设计'
    }
  },
  {
    // 事项实例状态
    path: '/process/status',
    name: 'ProcessStatus',
    component: () => import('../views/common/ProcessStatus.vue'),
    meta: {
      title: '事项实例状态'
    }
  },
  {
    // 待审批事项
    path: '/leader/affair/list',
    name: 'LeaderAffairList',
    component: () => import('../views/leader/Index.vue'),
    meta: {
      title: '待审批事项'
    }
  },
  {
    // 可申请事项
    path: '/staff/affair/list',
    name: 'StaffProcessStatus',
    component: () => import('../views/staff/Index.vue'),
    meta: {
      title: '可申请事项'
    }
  },
  {
    // 可申请事项
    path: '/staff/affair/history',
    name: 'StaffProcessHistory',
    component: () => import('../views/staff/history.vue'),
    meta: {
      title: '申请历史'
    }
  }
]

const router = new VueRouter({
  routes, mode: 'history'
})

export default router
